package net.wanho.controller;

import net.wanho.entity.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.Date;

/**
 * Author：汤小洋
 * Date：2023-07-19 13:45
 * Description：<描述>
 */
@RestController
public class AjaxController {

    @RequestMapping("/ajax")
    public User ajax(){
       User user = new User(1,"zhangsan","123456",18,new Date());
        return user;
    }

    @RequestMapping("/addUser")
    public String addUser(@Valid User user){ // @Valid 开启对User对象的数据校验
        System.out.println(user);
        return "success";
    }

}
